from time import*
f1 = [int(i) for i in open('m1_sorted.txt', 'r').read().split()]
f2 = [int(i) for i in open('m2_reverse.txt', 'r').read().split()]
f3 = [int(i) for i in open('m3_shuffle.txt', 'r').read().split()]

def puzir(a):
    t_start = time()
    for j in range(1, len(a)):
        for i in range(len(a)-j):
            if a[i] > a[i + 1]:
                a[i], a[i+1] = a[i+1], a[i]
    t_finish = time()
    return (t_finish - t_start)


print('m1_sorted.txt', round(puzir(f1) * 1000), 'milliseconds')
print('m2_reverse.txt', round(puzir(f2) * 1000), 'milliseconds')
print('m3_shuffle.txt', round(puzir(f3) * 1000), 'milliseconds')

